package com.qxl.forest.business.persistence.dao;

import com.qxl.forest.business.persistence.entity.Relation;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author: qiuxinlin
 * @Dercription:
 * @Date: 9:44 2017/11/27
 */
@Repository
public interface RelationDao extends JpaRepository<Relation, Integer> {
    /**
     * 通过角色id查找关系
     *
     * @param roleId
     * @return
     */
    List<Relation> findByRoleid(Integer roleId);

    /**
     * 通过menuId删除关系
     *
     * @param menuId
     */
    void deleteByMenuid(Integer menuId);

    /**
     * 删除该角色所有的权限
     *
     * @param roleId
     */
    void deleteByRoleid(Integer roleId);
}
